home *** CD-ROM | disk | FTP | other *** search
/ Shareware Grab Bag / Shareware Grab Bag.iso / 001 / pibt3sp1.arc / HANGUP.PAS < prev    next >
Pascal/Delphi Source File  |  1985-09-04  |  3KB  |  72 lines

  1.  
  2. (*----------------------------------------------------------------------*)
  3. (*                   HangUpPhone  --- Hang up the phone                 *)
  4. (*----------------------------------------------------------------------*)
  5.  
  6. PROCEDURE HangUpPhone;
  7.  
  8. (*----------------------------------------------------------------------*)
  9. (*                                                                      *)
  10. (*     Procedure:  HangUpPhone                                          *)
  11. (*                                                                      *)
  12. (*     Purpose:    Hangs up the phone.                                  *)
  13. (*                                                                      *)
  14. (*     Calling Sequence:                                                *)
  15. (*                                                                      *)
  16. (*        HangUpPhone;                                                  *)
  17. (*                                                                      *)
  18. (*                                                                      *)
  19. (*     Calls:                                                           *)
  20. (*                                                                      *)
  21. (*        DELAY                                                         *)
  22. (*        Send_Modem_Command                                            *)
  23. (*        Async_Term_Ready                                              *)
  24. (*        Async_Receive_With_Timeout                                    *)
  25. (*                                                                      *)
  26. (*     Remarks:                                                         *)
  27. (*                                                                      *)
  28. (*        If a modem command delay string and a mode hang-up string     *)
  29. (*        are specified, they are used.  If not, the phone is hung      *)
  30. (*        up by dropping DTR.                                           *)
  31. (*                                                                      *)
  32. (*----------------------------------------------------------------------*)
  33.  
  34. VAR
  35.    Garbage_Ch: INTEGER;
  36.    Done_Flag : BOOLEAN;
  37.  
  38. BEGIN (* HangUpPhone *)
  39.                                    (* If modem hang-up command given, *)
  40.                                    (* use it.                         *)
  41.  
  42.    IF Modem_Hang_Up <> '' THEN
  43.       BEGIN
  44.  
  45.          DELAY( Modem_Escape_Time );
  46.  
  47.          Send_Modem_Command( Modem_Escape );
  48.  
  49.          DELAY( Modem_Escape_Time );
  50.  
  51.          Send_Modem_Command( Modem_Hang_Up );
  52.  
  53.          DELAY( Modem_Escape_Time );
  54.  
  55.       END;
  56.                                    (* If no hangup command provided, *)
  57.                                    (* or it didn't work, drop DTR.   *)
  58.  
  59.    IF ( Modem_Hang_Up = '' ) OR ( Async_Carrier_Detect ) THEN
  60.       BEGIN
  61.  
  62.          Async_Term_Ready( FALSE );
  63.  
  64.          DELAY( One_Second_Delay );
  65.  
  66.          Async_Term_Ready( TRUE );
  67.  
  68.       END;
  69.                                    (* Swallow any garbage characters *)
  70.    Async_Purge_Buffer;
  71.  
  72. END   (* HangUpPhone *);